package com.engine.zzworkflow.cmd;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;

import java.util.HashMap;
import java.util.Map;

public class sendBeCurrentBusinessCmd extends AbstractCommonCommand<Map<String,Object>> {
    @Override
    public BizLogContext getLogContext() {
        return null;
    }

    public sendBeCurrentBusinessCmd(User user, Map<String, Object> params) {
        this.params = params;
        this.user =user;
    }

    @Override
    public Map<String, Object> execute(CommandContext commandContext) {

        Map<String,Object> apidatas  = new HashMap<>();
        apidatas.put("api_status", false);

        //流程requestid
        String requestid = Util.null2String(params.get("requestid"));
        //流程workflowid
        String workflowid = Util.null2String(params.get("workflowid"));
        //会计引擎凭证模板ID
        // String businessTypeId = Util.null2String(params.get("businessTypeId"));
        //当前单据回写时凭证信息是明细
        String mx = Util.null2String(params.get("mx"));
        RecordSet rs = new RecordSet();
        String tablename = getWfTablenamById(workflowid, rs);
        if("".equals(tablename)) {
            writeLog("获取流程表名失败");
            apidatas.put("err", "获取流程表名失败");
            return apidatas;
        }

        BaseBean bb = new BaseBean();
        String url = bb.getPropValue("zzflowbusinessurl", "receiveDataurl");
        if("".equals(url)) {
            writeLog("抛送会计引擎接口地址配置文件未配置");
            apidatas.put("err", "抛送会计引擎接口地址配置文件未配置");
            return apidatas;
        }
       /* if("".equals(businessTypeId)) {
            writeLog("会计引擎凭证模板id,businessTypeId未配置");
            apidatas.put("err", "会计引擎凭证模板id,businessTypeId未配置");
            return apidatas;
        }*/
        writeLog("抛送会计引擎接口地址配url："+url);
        Map<String ,String> map=getSendParams(tablename, requestid, mx);
        String sendParams = map.get("params");
        writeLog("请求参数sendParams："+sendParams);

        String bdh=map.get("bdh");

        String res = sendJson(url, sendParams);
        JSONObject resObj = JSONObject.fromObject(res);
        writeLog("res:"+res);
        if(resObj.containsKey("statusCode")
                && "200".equals(resObj.getString("statusCode"))) {
            apidatas.put("api_status", true);
            apidatas.put("res", resObj.getString("responseBosy"));
            RecordSet recordSet=new RecordSet();
            String userName=changeField(String.valueOf(user.getUID()),"hrmresource", "id", "workcode", recordSet);;
            if(userName==null || userName.equals("")){
                userName="admin";
            }
            String openBusinessUrl="http://172.21.182.242:8880/business/receiveData/getPrefaUrl?userName="+userName+"&businessDataId="+bdh;
            String resGet=getJson(openBusinessUrl);
            JSONObject resObjGet = JSONObject.fromObject(resGet);
            String pzUrl=resObjGet.getString("responseBosy");
            apidatas.put("data",pzUrl);
            String actionTableName= Util.null2String(params.get("tablename"));
            String actionrequestid=Util.null2String(params.get("requestid"));
            if(actionTableName!=null&& actionTableName.equals("")){
                RecordSet actionSet=new RecordSet();
                String actionSql="update "+actionTableName+" set ljzdm=? where requestId=?";
                actionSet.executeUpdate(actionSql, pzUrl, actionrequestid);
            }

        }else {
            apidatas.put("api_status", false);
            apidatas.put("statusCode", resObj.getString("statusCode"));
            apidatas.put("err", resObj.getString("err"));
        }

        return apidatas;
    }

    /**
     * 获取接口请求参数
     * @param tablename
     * @param requestid
     * @param mx
     * @return
     */
    private Map<String, String> getSendParams(String tablename, String requestid, String mx) {
        Map<String, String> map = new HashMap<>();
        RecordSet rs = new RecordSet();
        RecordSet rs2 = new RecordSet();

        //获取流程主表数据
        HashMap<String, String> mainData = new HashMap<>();
        mainData.put("mx", mx);
        String mainid = "0";
        String sql = "select * from uf_ywtokjyqzjb where  lyywbm= ? and lylc=? ";
        boolean b = rs.executeQuery(sql, tablename,requestid);
        if(b && rs.next()) {
            mainid = rs.getString("id");
            //凭证日期	rzrq	凭证日期	凭证日期	rzrq
            String rzrq = Util.null2String(rs.getString("rzrq"));
            mainData.put("rzrq", rzrq);
            //流程编码	bdh	备选参考编号	表单号	bdh
            String bdh = Util.null2String(rs.getString("bdh"));
            mainData.put("bdh", bdh);
            map.put("bdh", bdh);
            //填单人	jbr	经办人（不传浪潮，返回到表单凭证明细）	报账人	jbr
            String jbr = Util.null2String(rs.getString("jbr"));
            jbr = changeField(jbr,"hrmresource", "id", "workcode", rs2);
            mainData.put("jbr", jbr);
            //填单人部门	jbrbm	经办人部门（不传浪潮，返回到表单凭证明细）	报账部门	jbrbm
            String jbrbm = Util.null2String(rs.getString("jbrbm"));
            jbrbm = changeField(jbrbm,"hrmdepartment", "id", "departmentcode", rs2);
            mainData.put("jbrbm", jbrbm);
            //所属公司	jbrgs	经办人公司（不传浪潮，返回到表单凭证明细）	所属公司编码	jbrgs
            String jbrgs = Util.null2String(rs.getString("jbrgs"));
            jbrgs = changeField(jbrgs,"hrmsubcompany", "id", "subcompanycode", rs2);
            mainData.put("jbrgs", jbrgs);
            //摘要	tzy	头摘要	摘要	tzy
            String tzy = Util.null2String(rs.getString("tzy"));
            mainData.put("tzy", tzy);
            //模板类型
            mainData.put("pid", "TY");
            //凭证制单人
            String zhidanren=Util.null2String(rs.getString("zhidanren"));
            zhidanren = changeField(zhidanren,"hrmresource", "id", "workcode", rs2);
            mainData.put("zhidanren", zhidanren);
            //凭证复核人
            String fuheren=Util.null2String(rs.getString("fuheren"));
            fuheren = changeField(fuheren,"hrmresource", "id", "workcode", rs2);
            mainData.put("fuheren", fuheren);


            //币种	zbbz	币种	zbbz
            String zbbz = Util.null2String(rs.getString("zbbz"));
            zbbz = changeField(zbbz,"ctrip_CurrencyType", "id", "svalue", rs2);
            mainData.put("zbbz", zbbz);
            //汇率	zbhl	汇率	汇率	zbhl
            String zbhl = Util.null2String(rs.getString("zbhl"));
            mainData.put("zbhl", zbhl);
            //付款账号	fkzh	付款账号	fkzh
            String fkzh = Util.null2String(rs.getString("fkzh"));
            mainData.put("fkzh", fkzh);
            //支付金额	zfje	支付金额	zfje
            String zfje= Util.null2String(rs.getString("zfje"));
            mainData.put("zfje", zfje);

            //收款账号	skzh	收款账号	skzh
            String skzh= Util.null2String(rs.getString("skzh"));
            mainData.put("skzh", skzh);
            //是否冲抵借款	sfcdjk	是否冲抵借款	sfcdjk
            String sfcdjk= Util.null2String(rs.getString("sfcdjk"));
            mainData.put("sfcdjk", sfcdjk);
            //是否预付	sfyf	是否预付	sfyf
            String sfyf= Util.null2String(rs.getString("sfyf"));
            mainData.put("sfyf", sfyf);
            //是否冲抵预付款	sfcdyfk	是否冲抵预付款	sfcdyfk
            String sfcdyfk= Util.null2String(rs.getString("sfcdyfk"));
            mainData.put("sfcdyfk", sfcdyfk);
            //是否结转预收	sfjzys	是否结转预收	sfjzys
            String sfjzys= Util.null2String(rs.getString("sfjzys"));
            mainData.put("sfjzys", sfjzys);
            //客商	ks	客商	ks
            /*String gys= Util.null2String(rs.getString("gys"));
            mainData.put("gys", gys);*/
            String ks= Util.null2String(rs.getString("ks"));
            mainData.put("ks", ks);
            //借款金额	ysbsy	借款金额	ysbsy
            String ysbsy= Util.null2String(rs.getString("ysbsy"));
            mainData.put("ysbsy", ysbsy);
            //是否冲抵预付款	jkje	是否冲抵预付款	jkje
            String jkje= Util.null2String(rs.getString("jkje"));
            mainData.put("jkje", jkje);
            //合同关联编号	htglbh	合同关联编号	htglbh
            String htglbh= Util.null2String(rs.getString("htglbh"));
            mainData.put("htglbh", htglbh);
            //项目编号	xmbh	项目编号	xmbh
            String xmbh= Util.null2String(rs.getString("xmbh"));
            mainData.put("xmbh", xmbh);
            //收款日期	sklx	收款日期	sklx
            String sklx= Util.null2String(rs.getString("sklx"));
            mainData.put("sklx", sklx);
            //合同关联编号	skrq	合同关联编号	skrq
            String skrq= Util.null2String(rs.getString("skrq"));
            mainData.put("skrq", skrq);
            //收款日期 skbh 收款日期    skbh
            //收款摘要	skzy	收款摘要	skzy
            String skzy= Util.null2String(rs.getString("skzy"));
            mainData.put("skzy", skzy);

            //是否冲销认领流程	sfcxrllc	是否冲销认领流程	sfcxrllc
            String sfcxrllc= Util.null2String(rs.getString("sfcxrllc"));
            mainData.put("sfcxrllc", sfcxrllc);
            //本次退回金额	bcthje	本次退回金额	bcthje
            String bcthje= Util.null2String(rs.getString("bcthje"));
            mainData.put("bcthje", bcthje);
            //可认领余额	krlye	可认领余额	krlye
            String krlye= Util.null2String(rs.getString("krlye"));
            mainData.put("krlye", krlye);
            //是否为负数应收单退回	sfwfsysdth	是否为负数应收单退回	sfwfsysdth
            String sfwfsysdth= Util.null2String(rs.getString("sfwfsysdth"));
            mainData.put("sfwfsysdth", sfwfsysdth);
            //是否年终奖      sfnzj     是否年终奖  sfnzj
            String sfnzj= Util.null2String(rs.getString("sfnzj"));
            mainData.put("sfnzj", sfnzj);
            //银行交易成功日期      yhjycgrq     银行交易成功日期  yhjycgrq
            String yhjycgrq= Util.null2String(rs.getString("yhjycgrq"));
            mainData.put("yhjycgrq", yhjycgrq);
            //转入分支行      zrfzh     转入分支行  zrfzh
            String zrfzh= Util.null2String(rs.getString("zrfzh"));
            String zrfzhbm=changeField(jbrbm,"uf_jccs_hmhhxb", zrfzh, "cyjghh", rs2);
            String zrfzhmc=changeField(jbrbm,"uf_jccs_hmhhxb", zrfzh, "cyjgqc", rs2);
            mainData.put("zrfzhmc", zrfzhmc);
            mainData.put("zrfzhbm", zrfzhbm);
            //银行类别      yhlb     银行类别  yhlb
            String yhlb= Util.null2String(rs.getString("yhlb"));
            mainData.put("yhlb", yhlb);
            //费用类型名称      fylxmc     费用类型名称  fylxmc
            String fylxmc= Util.null2String(rs.getString("fylxmc"));
            mainData.put("fylxmc", fylxmc);
            //报表编号      bbbh     报表编号  bbbh
            String bbbh= Util.null2String(rs.getString("bbbh"));
            mainData.put("bbbh", bbbh);
            //费用类型编码      fylxbm     费用类型编码  xshsje
            String fylxbm= Util.null2String(rs.getString("fylxbm"));
            mainData.put("xshsje", fylxbm);
            //虚拟客户编码      xnkhbm     虚拟客户编码  xnkhbm
            String xnkhbm= Util.null2String(rs.getString("xnkhbm"));
            mainData.put("xnkhbm", xnkhbm);
            //含税金额/100      hsje100     含税金额/100  hsje100
            String hsje100= Util.null2String(rs.getString("hsje100"));
            mainData.put("hsje100", hsje100);
            //不含税金额/100      bhsje100     不含税金额/100  xsbhsje
            String bhsje100= Util.null2String(rs.getString("bhsje100"));
            mainData.put("xsbhsje", bhsje100);
            //含税金额      xsse     含税金额  xsse
            String xsse= Util.null2String(rs.getString("xsse"));
            mainData.put("xsse", xsse);
            //费用类型名称      hsje     费用类型名称  hsje
            String hsje= Util.null2String(rs.getString("hsje"));
            mainData.put("hsje", hsje);
            //不含税金额      bhsje     不含税金额  bhsje
            String bhsje= Util.null2String(rs.getString("bhsje"));
            mainData.put("bhsje", bhsje);
            //税额      se     税额  se
            String se= Util.null2String(rs.getString("se"));
            mainData.put("se", se);
            //收入类别      srlb     收入类别  srlbbm
            String srlb= Util.null2String(rs.getString("srlb"));
            mainData.put("srlbbm", srlb);
            //含税金额(收单-发卡）      hsjesdfk     含税金额(收单-发卡）  hsjesdfk
            String hsjesdfk= Util.null2String(rs.getString("hsjesdfk"));
            mainData.put("hsjesdfk", hsjesdfk);
            //不含税金额(收单-发卡）      bhsjesdfk     不含税金额(收单-发卡）  bhsjesdfk
            String bhsjesdfk= Util.null2String(rs.getString("bhsjesdfk"));
            mainData.put("bhsjesdfk", bhsjesdfk);
            //含税金额(次月10日收单-当月发卡)      sesdfk     含税金额(次月10日收单-当月发卡)  sesdfk
            String sesdfk= Util.null2String(rs.getString("sesdfk"));
            mainData.put("sesdfk", sesdfk);
            //含税金额(次月10日收单-当月发卡)      hsjecy10rsdfa     含税金额(次月10日收单-当月发卡)  cyfkhsje
            String hsjecy10rsdfa= Util.null2String(rs.getString("hsjecy10rsdfa"));
            mainData.put("cyfkhsje", hsjecy10rsdfa);
            //不含税金额(次月10日收单-当月发卡))      bhsjecy10rsdfa     不含税金额(次月10日收单-当月发卡))  cyfkbhsje
            String bhsjecy10rsdfa= Util.null2String(rs.getString("bhsjecy10rsdfa"));
            mainData.put("cyfkbhsje", bhsjecy10rsdfa);
            //税额(次月10日收单-当月发卡))      secy10rsdfa     税额(次月10日收单-当月发卡))  cyfkse
            String secy10rsdfa= Util.null2String(rs.getString("secy10rsdfa"));
            mainData.put("cyfkse", secy10rsdfa);
            //含税金额(发卡-收单）      hsfksd     含税金额(发卡-收单）  fksdhsje
            String hsfksd= Util.null2String(rs.getString("hsfksd"));
            mainData.put("fksdhsje", hsfksd);
            //不含税金额(发卡-收单）      bhsfksd     不含税金额(发卡-收单）  fksdbhsje
            String bhsfksd= Util.null2String(rs.getString("bhsfksd"));
            mainData.put("fksdbhsje", bhsfksd);
            //税额(发卡-收单）      sefksd     税额(发卡-收单）  fksdse
            String sefksd= Util.null2String(rs.getString("sefksd"));
            mainData.put("fksdse", sefksd);
            //计费类型代码      bhsfksd     计费类型代码  jflxdm
            String jflxdm= Util.null2String(rs.getString("jflxdm"));
            mainData.put("jflxdm", jflxdm);
            //划拨类型    hblx     划拨类型  hblxbm
            String hblx= Util.null2String(rs.getString("hblx"));
            mainData.put("hblxbm", hblx);
            //付款日期      fkrq     付款日期  zbfkrq
            String fkrq= Util.null2String(rs.getString("fkrq"));
            mainData.put("zbfkrq", fkrq);
            //国家科技项目编号      kjxmbh     国家科技项目编号  kjxmbh
            String kjxmbh= Util.null2String(rs.getString("kjxmbh"));
            mainData.put("kjxmbh", kjxmbh);
            //在建工程编号      zjgcbh    在建工程编号  zjgcbh
            String zjgcbh= Util.null2String(rs.getString("zjgcbh"));
            mainData.put("zjgcbh", zjgcbh);
            //付款类型      fklx     付款类型  zbfklx
            String fklx= Util.null2String(rs.getString("fklx"));
            mainData.put("zbfklx", fklx);
            //是否专票      sfzp     是否专票  zbfklx
            String sfzp= Util.null2String(rs.getString("sfzp"));
            mainData.put("sfzp", sfzp);
            //应支付总额      fklx     应支付总额  zbfklx
            String yzfze= Util.null2String(rs.getString("yzfze"));
            mainData.put("yzfze", yzfze);
            //资产处置结转损益      zcczjzsy     资产处置结转损益  zcczjzsy
            String zcczjzsy= Util.null2String(rs.getString("zcczjzsy"));
            mainData.put("zcczjzsy", zcczjzsy);
            //销项税类型      xxslx     销项税类型  xxslx
            String xxslx= Util.null2String(rs.getString("xxslx"));
            mainData.put("xxslx", xxslx);
            //付款类型      fklx     付款类型  zbbzje
            String bzje= Util.null2String(rs.getString("bzje"));
            mainData.put("zbbzje", bzje);
            //报账金额*（-1）      bzjefs     报账金额*（-1）  bzjefs
            String bzjefs= Util.null2String(rs.getString("bzjefs"));
            mainData.put("bzjefs", bzjefs);
            //日报流水类型      rlslx     日报流水类型  rlslx
            String rlslx= Util.null2String(rs.getString("rlslx"));
            mainData.put("rlslx", rlslx);
            //活动类型      hdlx     活动类型  zbhdlx
            String hdlx= Util.null2String(rs.getString("hdlx"));
            mainData.put("zbhdlx", hdlx);
            //清算日期      qsrq     清算日期  qsrq
            String qsrq= Util.null2String(rs.getString("qsrq"));
            mainData.put("qsrq", qsrq);
            //营销平台事项申请单号      yxptsxsqdh     营销平台事项申请单号  yxptsxsqdh
            String yxptsxsqdh= Util.null2String(rs.getString("yxptsxsqdh"));
            mainData.put("yxptsxsqdh", yxptsxsqdh);
            //营销平台活动授权码      yxpthdsqm     营销平台活动授权码  yxpthdsqm
            String yxpthdsqm= Util.null2String(rs.getString("yxpthdsqm"));
            mainData.put("yxpthdsqm", yxpthdsqm);
            //活动类型      hdlx1     活动类型  hdlxbm
            String hdlx1= Util.null2String(rs.getString("hdlx1"));
            mainData.put("hdlxbm", hdlx1);
            //资金来源      zjly     资金来源  zjly
            String zjly= Util.null2String(rs.getString("zjly"));
            mainData.put("zjly", zjly);
            //经济事项      jjsx     经济事项  jjsxbm
            String jjsx= Util.null2String(rs.getString("jjsx"));
            mainData.put("jjsxbm", jjsx);
            //清算金额*内部使用比例      qsjenbsybl     清算金额*内部使用比例  qsjenbsybl
            String qsjenbsybl= Util.null2String(rs.getString("qsjenbsybl"));
            mainData.put("qsjenbsybl", qsjenbsybl);
            //清算金额      qsje     清算金额  qsje
            String qsje= Util.null2String(rs.getString("qsje"));
            mainData.put("qsje", qsje);
            //是否为大协议      sfwdxy     是否为大协议  sfwdxy
            String sfwdxy= Util.null2String(rs.getString("sfwdxy"));
            mainData.put("sfwdxy", yxptsxsqdh);
            //是否为积点业务      sfwjdyw     是否为积点业务  sfwjdyw
            String sfwjdyw= Util.null2String(rs.getString("sfwjdyw"));
            mainData.put("sfwjdyw", sfwjdyw);
            //核销/核定类型      hxlx     核销/核定类型  hxlx
            String hxlx= Util.null2String(rs.getString("hxlx"));
            mainData.put("hxlx", hxlx);
            //本次缴纳核销金额      bcjnje     本次缴纳核销金额  bcjnje
            String bcjnje= Util.null2String(rs.getString("bcjnje"));
            mainData.put("bcjnje", bcjnje);
            //本次核销金额      bchxje     本次核销金额  bchxje
            String bchxje= Util.null2String(rs.getString("bchxje"));
            mainData.put("bchxje", bchxje);
            //核定内部使用金额-已入账金额      syjrz     核定内部使用金额-已入账金额  syjrz
            String syjrz= Util.null2String(rs.getString("syjrz"));
            mainData.put("syjrz", syjrz);
            //已入账金额-已核销金额      rzjhx     已入账金额-已核销金额  rzjhx
            String rzjhx= Util.null2String(rs.getString("rzjhx"));
            mainData.put("rzjhx", rzjhx);
            //已入账金额-已核销金额（负数）      fsrzjhx     已入账金额-已核销金额（负数）  fsrzjhx
            String fsrzjhx= Util.null2String(rs.getString("fsrzjhx"));
            mainData.put("fsrzjhx", fsrzjhx);
            //财务是否结束      cwsfjs     财务是否结束  cwsfjs
            String cwsfjs= Util.null2String(rs.getString("cwsfjs"));
            mainData.put("cwsfjs", cwsfjs);
            //确认计提金额      qrjtje     确认计提金额  qrjtje
            String qrjtje= Util.null2String(rs.getString("qrjtje"));
            mainData.put("qrjtje", qrjtje);
            //合同计提余额      htjtye     合同计提余额  bchxje
            String htjtye= Util.null2String(rs.getString("htjtye"));
            mainData.put("htjtye", htjtye);

        }

        //接口入参
        JSONArray params = new JSONArray();
        sql = "select * from uf_ywtokjyqzjb_dt1 where mainid = ?";
        boolean b1 = rs.executeQuery(sql, mainid);
        while (b1 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //入账主体	hszt	核算主体	核算主体编码	hszt
            String hszt = Util.null2String(rs.getString("hszt"));
            hszt = changeField(hszt,"uf_jccs_zt ", "id", "ztbm", rs2);
            dt1data.put("hszt", hszt);
            //币种	bz	货币编码	货币编码	bz
            String bz = Util.null2String(rs.getString("bz"));
            bz = changeField(bz,"ctrip_CurrencyType", "id", "svalue", rs2);
            dt1data.put("bz", bz);
            //汇率	hl	汇率	汇率	hl
            String hl = Util.null2String(rs.getString("hl"));
            dt1data.put("hl", hl);
            //行摘要	hzy	行摘要	行摘要	hzy
            String hzy = Util.null2String(rs.getString("hzy"));
            dt1data.put("hzy", hzy);
            //会计科目 hjkm
            String hjkm = Util.null2String(rs.getString("hjkm"));
            hjkm=getTreeId(hjkm);
            hjkm = changeField(hjkm,"uf_jccs_hskm", "id", "hskmbm", rs2);
            dt1data.put("hjkm", hjkm);
            //贷款方向 jdfx
            String jdfx = Util.null2String(rs.getString("jdfx"));
            jdfx=jdfx(jdfx);
            dt1data.put("jdfx", jdfx);
            //活动类型 hdlx
            String hdlx = Util.null2String(rs.getString("hdlx"));
            hdlx=hdfx(hdlx);
            dt1data.put("hdlx", hdlx);

            //股东类型	gdlx	股东类型	股东类型	gdlx
            String gdlx = Util.null2String(rs.getString("gdlx"));
            gdlx = changeField(gdlx,"uf_jccs_dgwldx", "id", "wldxbm", rs2);
            dt1data.put("gdlx", gdlx);
            //客商	ks	客商	客商	ks
            String ks = Util.null2String(rs.getString("ks"));
            ks = changeField(ks,"uf_jccs_dgwldx", "id", "wldxbm", rs2);
            dt1data.put("ks", ks);
            //合同	ht	合同	合同	ht
            String ht = Util.null2String(rs.getString("ht"));
            ht = changeField(ht,"uf_zchttz", "id", "htbh", rs2);
            dt1data.put("ht", ht);
            //出资方式	czfs	出资方式	出资方式	czfs
            String czfs = Util.null2String(rs.getString("czfs"));
            czfs=czfsbm(czfs);
            dt1data.put("czfs", czfs);
            //核算业务分类	hsywfl	核算业务分类	核算业务分类	hsywfl
            String hsywfl = Util.null2String(rs.getString("hsywfl"));
            hsywfl = changeField(hsywfl,"uf_jccs_hsywfl", "id", "dm", rs2);
            dt1data.put("hsywfl", hsywfl);
            //项目	xm	项目	项目	xm
            String xm = Util.null2String(rs.getString("xm"));
            xm = changeField(xm,"uf_jccs_yskmysxmywlx", "id", "yskmbm", rs2);
            dt1data.put("xm", xm);
            //员工类型	yglx	员工类型	员工类型	yglx
            String yglx = Util.null2String(rs.getString("yglx"));
            yglx = changeField(yglx,"uf_jccs_yglx", "id", "bh", rs2);
            dt1data.put("yglx", yglx);
            //个人	gr	个人	个人	gr
            String gr = Util.null2String(rs.getString("gr"));
            gr = changeField(gr,"hrmresource", "id", "workcode", rs2);
            dt1data.put("gr", gr);
            //银行账户	yhzh	银行账户	银行账户	yhzh
            String yhzh = Util.null2String(rs.getString("yhzh"));
            yhzh = changeField(yhzh,"uf_yhzhxxb", "id", "yhzh", rs2);
            dt1data.put("yhzh", yhzh);
            //银行类别	yhlb	银行类别	银行类别	yhlb
            String yhlb = Util.null2String(rs.getString("yhlb"));
            yhlb = changeField(yhlb,"uf_jccs_yhlb", "id", "bh", rs2);
            dt1data.put("yhlb", yhlb);
            //部门	bm	部门	部门	bm
            String bm = Util.null2String(rs.getString("bm"));
            bm = changeField(bm,"hrmdepartment", "id", "departmentcode", rs2);
            dt1data.put("bm", bm);
            //内部往来公司段	nbwlgsd	内部外来公司段	内部往来公司段	nbwlgsd
            String nbwlgsd = Util.null2String(rs.getString("nbwlgsd"));
            nbwlgsd = changeField(nbwlgsd,"uf_jccs_dgwldx", "id", "wldxbm", rs2);
            dt1data.put("nbwlgsd", nbwlgsd);
            //tzdx	投资对象	投资对象	tzdx
            String tzdx = Util.null2String(rs.getString("tzdx"));
            nbwlgsd = changeField(nbwlgsd,"uf_jccs_dgwldx", "id", "wldxbm", rs2);
            dt1data.put("tzdx", tzdx);
            //科技项目	kjxm	科技项目	科技项目	kjxm
            String kjxm = Util.null2String(rs.getString("kjxm"));
            kjxm = changeField(kjxm,"uf_jccs_kjxm", "id", "xmdm", rs2);
            dt1data.put("kjxm", kjxm);
            //品种	pz	品种	品种	pz
            String pz = Util.null2String(rs.getString("pz"));
            pz = changeField(pz,"uf_jccs_pz", "id", "bh", rs2);
            dt1data.put("pz", pz);
            //借方金额	jfje	金额	借方金额	jfje
            String jfje = Util.null2String(rs.getString("jfje"));
            dt1data.put("jfje", jfje);
            //贷方金额	dfje	金额	贷方金额	dfje
            String dfje = Util.null2String(rs.getString("dfje"));
            dt1data.put("dfje", dfje);
            //借方外币	jfwb	金额	借方外币金额	jfwbje
            String jfwbje = Util.null2String(rs.getString("jfwb"));
            dt1data.put("jfwbje", jfwbje);
            //贷方外币	dfwb	金额	贷方外币金额	dfwbje
            String dfwbje = Util.null2String(rs.getString("dfwb"));
            dt1data.put("dfwbje", dfwbje);

            //经济事项	jjsx	经济事项编码	jjsxbm  经济事项名臣 jjsxmc
            String jjsx = Util.null2String(rs.getString("jjsx"));
            jjsx=getTreeId(jjsx);
            String jjsxbm = changeField(jjsx,"uf_jccs_jjsx", "id", "bm", rs2);
            String jjsxmc = changeField(jjsx,"uf_jccs_jjsx", "id", "jjsx", rs2);
            dt1data.put("jjsxbm", jjsxbm);
            dt1data.put("jjsxmc", jjsxmc);
            //部门属性	bmsx	部门属性	bmsx
            String bmsx  = Util.null2String(rs.getString("bmsx"));
            bmsx=bmsx(bmsx);
            dt1data.put("bmsx", bmsx);
            //报账金额	bzje	报账金额	bzje
            String bzje = Util.null2String(rs.getString("bzje"));
            dt1data.put("bzje", bzje);
            //税额	se	税额	se
            String se = Util.null2String(rs.getString("se"));
            dt1data.put("se", se);
            //未税金额	wsje	未税金额	wsje
            String wsje = Util.null2String(rs.getString("wsje"));
            dt1data.put("wsje", wsje);

            //合同关联编号    htglbh  费用明细-合同编号   fymxhtbh
            String htbh = Util.null2String(rs.getString("htglbh"));
            dt1data.put("fymxhtbh", htbh);
            //发票类型    fplx  费用明细-发票类型   fymxfplx
            String fymxfplx = Util.null2String(rs.getString("fplx"));
            dt1data.put("fymxfplx", fymxfplx);
            //合同关联编号    htglbh  费用明细-合同编号   fymxxmbh
            String xmbh = Util.null2String(rs.getString("xmbh"));
            dt1data.put("fymxxmbh", xmbh);
            //冲计提金额    cjtje  冲计提金额   fymxcjtje
            String cjtje = Util.null2String(rs.getString("cjtje"));
            dt1data.put("fymxcjtje", cjtje);
            //预付金额    yfje  预付金额   fymxyfje
            String yfje = Util.null2String(rs.getString("yfje"));
            dt1data.put("fymxyfje", yfje);
            //企业所得税    qysds  企业所得税   fymxqysds
            String qysds = Util.null2String(rs.getString("qysds"));
            dt1data.put("fymxqysds", qysds);
            //增值税    zzs  增值税   fymxzzs
            String zzs = Util.null2String(rs.getString("zzs"));
            dt1data.put("fymxzzs", zzs);
            //本方科目编码    bfkmbm  本方科目编码   bfkmbm
            String bfkmbm = Util.null2String(rs.getString("bfkmbm"));
            dt1data.put("fymxbfkmbm", bfkmbm);

            //对方科目编码 dfkmbm 费用明细 费用明细-对方科目编码 fymxdfkmbm
            String dfkmbm = Util.null2String(rs.getString("dfkmbm"));
            dt1data.put("fymxdfkmbm", dfkmbm);
            //本方子目编码 bfzmbm 费用明细 费用明细-本方子目编码 fymxbfzmbm
            String bfzmbm = Util.null2String(rs.getString("bfzmbm"));
            dt1data.put("fymxbfzmbm", bfzmbm);
            //对方子目编码 dfzmbm 费用明细 费用明细-对方子目编码 fymxdfzmbm
            String dfzmbm = Util.null2String(rs.getString("dfzmbm"));
            dt1data.put("fymxdfzmbm", dfzmbm);
            //现金流编码 xjllbm 费用明细 费用明细-现金流编码 fymxxjllbm
            String xjllbm = Util.null2String(rs.getString("xjllbm"));
            dt1data.put("fymxxjllbm", xjllbm);
            //薪酬项目 xcxm 费用明细 费用明细-薪酬项目编码 fymxxcxmbm
            String xcxm = Util.null2String(rs.getString("xcxm"));
            dt1data.put("fymxxcxmbm", xcxm);
            //计提金额 jtje 费用明细 费用明细-计提金额 fymxjtje
            String jtje = Util.null2String(rs.getString("jtje"));
            dt1data.put("fymxjtje", jtje);
            //员工类型 yglx1 费用明细 费用明细-员工类型 fymxyglx
            String yglx1 = Util.null2String(rs.getString("yglx1"));
            dt1data.put("fymxyglx", yglx1);
            //计提说明 jtsm 费用明细 费用明细-计提说明 fymxjtsm
            String jtsm = Util.null2String(rs.getString("jtsm"));
            dt1data.put("fymxjtsm", jtsm);
            //本次预付核销金额 bcyfhxje 费用明细 费用明细-本次预付核销金额 fymxbcyfhxje
            String bcyfhxje = Util.null2String(rs.getString("bcyfhxje"));
            dt1data.put("fymxbcyfhxje", bcyfhxje);
            //薪酬选项 xcxx 费用明细 费用明细-薪酬选项 fymxxcxx
            String xcxx = Util.null2String(rs.getString("xcxx"));
            dt1data.put("fymxxcxx", xcxx);
            //计提个税金额 jtgsje 费用明细 费用明细-计提个税金额 fymxjtgsje
            String jtgsje = Util.null2String(rs.getString("jtgsje"));
            dt1data.put("fymxjtgsje", jtgsje);



            params.add(dt1data);
        }


        sql = "select * from uf_ywtokjyqzjb_dt9 where mainid = ?";
        boolean b9 = rs.executeQuery(sql, mainid);
        while (b9 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //本次核销合同计提金额 bchxhtjtje 费用明细 费用明细-本次核销合同计提金额 fymxbchxhtjtje
            String bchxhtjtje = Util.null2String(rs.getString("bchxhtjtje"));
            dt1data.put("fymxbchxhtjtje", bchxhtjtje);
            //费用承担部门 fycdbm 分摊明细 分摊明细-费用承担部门 ftmxfycdbm
            String fycdbm = Util.null2String(rs.getString("fycdbm"));
            dt1data.put("ftmxfycdbm", fycdbm);
            //费用承担主体 fycdzt 分摊明细 分摊明细-费用承担主体 ftmxfycdzt
            String fycdzt = Util.null2String(rs.getString("fycdzt"));
            dt1data.put("ftmxfycdzt", fycdzt);
            //部门属性 bmsx 分摊明细 分摊明细-部门属性 ftmxbmsx
            String bmsx = Util.null2String(rs.getString("bmsx"));
            dt1data.put("ftmxbmsx", bmsx);
            //正式员工工资 zsyggz 分摊明细 正式员工工资 ftmxzsyggz
            String zsyggz = Util.null2String(rs.getString("zsyggz"));
            dt1data.put("ftmxzsyggz", zsyggz);
            //正式员工奖金 zsygjj 分摊明细 正式员工奖金 ftmxzsygjj
            String zsygjj = Util.null2String(rs.getString("zsygjj"));
            dt1data.put("ftmxzsygjj", zsygjj);
            //正式员工其他工资 zsygqtgz 分摊明细 正式员工其他工资 ftmxzsygqtgz
            String zsygqtgz = Util.null2String(rs.getString("zsygqtgz"));
            dt1data.put("ftmxzsygqtgz", zsygqtgz);
            //正式员工其他奖金 zsygqtjj 分摊明细 正式员工其他奖金 zsygqtjj
            String zsygqtjj = Util.null2String(rs.getString("zsygqtjj"));
            dt1data.put("zsygqtjj", zsygqtjj);
            //福利费 flf 分摊明细 福利费 flf
            String flf = Util.null2String(rs.getString("flf"));
            dt1data.put("flf", flf);
            //补充养老保险 bcylbx 分摊明细 补充养老保险 bcylbx
            String bcylbx = Util.null2String(rs.getString("bcylbx"));
            dt1data.put("bcylbx", bcylbx);
            //补充医疗正式工 bcylzsg 分摊明细 补充医疗正式工 bcylzsg
            String bcylzsg = Util.null2String(rs.getString("bcylzsg"));
            dt1data.put("bcylzsg", bcylzsg);
            //派遣员工奖金 pqygjj 分摊明细 派遣员工奖金 pqygjj
            String pqygjj = Util.null2String(rs.getString("pqygjj"));
            dt1data.put("pqygjj", pqygjj);
            //派遣员工工资 pqyggz 分摊明细 派遣员工工资 pqyggz
            String pqyggz = Util.null2String(rs.getString("pqyggz"));
            dt1data.put("pqyggz", pqyggz);
            //其他员工奖金 qtygjj 分摊明细 其他员工奖金 qtygjj
            String qtygjj = Util.null2String(rs.getString("qtygjj"));
            dt1data.put("qtygjj", qtygjj);
            //其他员工工资 qtyggz 分摊明细 其他员工工资 qtyggz
            String qtyggz = Util.null2String(rs.getString("qtyggz"));
            dt1data.put("qtyggz", qtyggz);
            //基本养老保险费 jbylbxf 分摊明细 基本养老保险费 jbylbxf
            String jbylbxf = Util.null2String(rs.getString("jbylbxf"));
            dt1data.put("jbylbxf", jbylbxf);
            //基本医疗保险费 jbyilbxf1 分摊明细 基本医疗保险费 jbyilbxf
            String jbyilbxf1 = Util.null2String(rs.getString("jbyilbxf1"));
            dt1data.put("jbyilbxf", jbyilbxf1);
            //失业保险费 sybxf 分摊明细 失业保险费 sybxf
            String sybxf = Util.null2String(rs.getString("sybxf"));
            dt1data.put("sybxf", sybxf);
            //工伤保险费 gsbxf 分摊明细 工伤保险费 gsbxf
            String gsbxf = Util.null2String(rs.getString("gsbxf"));
            dt1data.put("gsbxf", gsbxf);
            //生育保险费 syubxf1 分摊明细 生育保险费 syubxf
            String syubxf1 = Util.null2String(rs.getString("syubxf1"));
            dt1data.put("syubxf", syubxf1);
            //其他社会保险费 qtshbxf 分摊明细 其他社会保险费 qtshbxf
            String qtshbxf = Util.null2String(rs.getString("qtshbxf"));
            dt1data.put("qtshbxf", qtshbxf);
            //住房公积金 zfgjj 分摊明细 住房公积金 zfgjj
            String zfgjj = Util.null2String(rs.getString("zfgjj"));
            dt1data.put("zfgjj", zfgjj);
            //补充住房公积金 bczfgjj 分摊明细 补充住房公积金 bczfgjj
            String bczfgjj = Util.null2String(rs.getString("bczfgjj"));
            dt1data.put("bczfgjj", bczfgjj);
            //工会经费 ghjf 分摊明细 工会经费 ghjf
            String ghjf = Util.null2String(rs.getString("ghjf"));
            dt1data.put("ghjf", ghjf);
            //基本养老保险费（派遣） jbylbxfpq1 分摊明细 基本养老保险费（派遣） jbylbxfpq
            String jbylbxfpq1 = Util.null2String(rs.getString("jbylbxfpq1"));
            dt1data.put("jbylbxfpq", jbylbxfpq1);
            //基本医疗保险费（派遣） jbyilbxfpq 分摊明细 基本医疗保险费（派遣） jbyilbxfpq
            String jbyilbxfpq = Util.null2String(rs.getString("jbyilbxfpq"));
            dt1data.put("jbyilbxfpq", jbyilbxfpq);
            //失业保险费（派遣） sybxfpq 分摊明细 失业保险费（派遣） sybxfpq
            String sybxfpq = Util.null2String(rs.getString("sybxfpq"));
            dt1data.put("sybxfpq", sybxfpq);
            //工伤保险费（派遣） gsbxfpq 分摊明细 工伤保险费（派遣） gsbxfpq
            String gsbxfpq = Util.null2String(rs.getString("gsbxfpq"));
            dt1data.put("gsbxfpq", gsbxfpq);
            //生育保险费（派遣） sybxfpq1 分摊明细 生育保险费（派遣） syubxfpq
            String sybxfpq1 = Util.null2String(rs.getString("sybxfpq1"));
            dt1data.put("syubxfpq", sybxfpq1);
            //其他社会保险费（派遣） qtshbxfpq 分摊明细 其他社会保险费（派遣） qtshbxfpq
            String qtshbxfpq = Util.null2String(rs.getString("qtshbxfpq"));
            dt1data.put("qtshbxfpq", qtshbxfpq);
            //住房公积金(派遣） zfgjjpq 分摊明细 住房公积金(派遣） zfgjjpq
            String zfgjjpq = Util.null2String(rs.getString("zfgjjpq"));
            dt1data.put("zfgjjpq", zfgjjpq);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt2 where mainid = ?";
        boolean b2 = rs.executeQuery(sql, mainid);
        while (b2 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //核销凭证号 hxpzh 流程明细（应付） 流程明细-核销凭证号 lcmxhxpzh
            String hxpzh = Util.null2String(rs.getString("hxpzh"));
            dt1data.put("lcmxhxpzh", hxpzh);
            //报账单号 bzdh 流程明细（应付） 流程明细-报账单号 lcmxbzdh
            String bzdh = Util.null2String(rs.getString("bzdh"));
            dt1data.put("lcmxbzdh", bzdh);
            //供应商 gys 流程明细（应付） 流程明细-供应商编码 lcmxgy
            String gys = Util.null2String(rs.getString("gys"));
            dt1data.put("lcmxgy", gys);
            //合同关联编号 htglbh 流程明细（应付） 流程明细-合同编号 lcmxhtbh
            String htglbh = Util.null2String(rs.getString("htglbh"));
            dt1data.put("lcmxhtbh", htglbh);
            //认领金额 bzje 流程明细（应付） 流程明细-认领金额 lcmxrlje
            String bzje = Util.null2String(rs.getString("bzje"));
            dt1data.put("lcmxrlje", bzje);


            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt24 where mainid = ?";
        boolean b24 = rs.executeQuery(sql, mainid);
        while (b24 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //借款-本次冲销金额 jkbccxje 借款核销明细 借款核销明细-借款-本次冲销金额 jkhxmxjkbccxje
            String jkbccxje = Util.null2String(rs.getString("jkbccxje"));
            dt1data.put("jkhxmxjkbccxje", jkbccxje);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt25 where mainid = ?";
        boolean b25 = rs.executeQuery(sql, mainid);
        while (b25 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //合同关联编号 yfmxhtbh 预付核销明细 预付核销明细-合同编号 yfhxmxhtbh
            String yfmxhtbh = Util.null2String(rs.getString("yfmxhtbh"));
            dt1data.put("yfhxmxhtbh", yfmxhtbh);
            //预付-本次冲销金额 yfbccxje 预付核销明细 预付核销明细-预付-本次冲销金额 yfhxmxyfbccxje
            String yfbccxje = Util.null2String(rs.getString("yfbccxje"));
            dt1data.put("yfhxmxyfbccxje", yfbccxje);
            //核销凭证号 hxpzh 预付核销明细 预付核销明细-核销凭证号 yfhxmxhxpzh
            String hxpzh = Util.null2String(rs.getString("hxpzh"));
            dt1data.put("yfhxmxhxpzh", hxpzh);
            //本次核销预付不含税金额 bchxyfbhsje 预付核销明细 预付核销明细-本次核销预付不含税金额 yfhxmxbchxyfbhsje
            String bchxyfbhsje = Util.null2String(rs.getString("bchxyfbhsje"));
            dt1data.put("yfhxmxbchxyfbhsje", bchxyfbhsje);
            //本次核销预付税额 bchxyfse 预付核销明细 预付核销明细-本次核销预付税额 yfhxmxbchxyfse
            String bchxyfse = Util.null2String(rs.getString("bchxyfse"));
            dt1data.put("yfhxmxbchxyfse", bchxyfse);
            //本次核销预付含税金额 bchxyfhsje 预付核销明细 预付核销明细-本次核销预付含税金额 yfhxmxbchxyfhsje
            String bchxyfhsje = Util.null2String(rs.getString("bchxyfhsje"));
            dt1data.put("yfhxmxbchxyfhsje", bchxyfhsje);
            //本次预付退回金额 bcyfthje 预付核销明细 预付核销明细-本次预付退回金额 yfhxmxbcyfthje
            String bcyfthje = Util.null2String(rs.getString("bcyfthje"));
            dt1data.put("yfhxmxbcyfthje", bcyfthje);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt26 where mainid = ?";
        boolean b26 = rs.executeQuery(sql, mainid);
        while (b26 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);

            //本次核销金额 bchxje 流水信息(还款单、押金保证金退回流程) 流水信息-本次核销金额 lsxxbchxje
            String bchxje = Util.null2String(rs.getString("bchxje"));
            dt1data.put("lsxxbchxje", bchxje);

            params.add(dt1data);

        }

        sql = "select * from uf_ywtokjyqzjb_dt27 where mainid = ?";
        boolean b27 = rs.executeQuery(sql, mainid);
        while (b27 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //付款日期 fkrq 支付明细 支付明细-付款日期 zfmxfkrq
            String fkrq = Util.null2String(rs.getString("fkrq"));
            dt1data.put("zfmxfkrq", fkrq);
            //支付金额 zfje 支付明细 支付明细-支付金额 zfmxzfje
            String zfje = Util.null2String(rs.getString("zfje"));
            dt1data.put("zfmxzfje", zfje);
            //付款状态 fkzt 支付明细 支付明细-付款状态 zfmxfkzt
            String fkzt = Util.null2String(rs.getString("fkzt"));
            dt1data.put("zfmxfkzt", fkzt);
            //付款单号 fkdh 支付明细 支付明细-付款单号 zfmxfkdh
            String fkdh = Util.null2String(rs.getString("fkdh"));
            dt1data.put("zfmxfkdh", fkdh);
            //银行账号 yhzh 支付明细 支付明细-银行账号 zfmxyhzh
            String yhzh = Util.null2String(rs.getString("yhzh"));
            dt1data.put("zfmxyhzh", yhzh);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt21 where mainid = ?";
        boolean b21 = rs.executeQuery(sql, mainid);
        while (b21 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //是否预收 sfys 收入明细 收入明细-是否预收 srmxsfys
            String sfys = Util.null2String(rs.getString("sfys"));
            dt1data.put("srmxsfys", sfys);
            //客商 ks 收入明细 收入明细-客商编码 srmxksbm
            String ks = Util.null2String(rs.getString("ks"));
            dt1data.put("srmxksbm", ks);
            //合同关联编号 htglbh 收入明细 收入明细-合同编号 srmxhtbh
            String htglbh = Util.null2String(rs.getString("htglbh"));
            dt1data.put("srmxhtbh", htglbh);
            //收入含税金额 srhsje 收入明细 收入明细-收入含税金额 srmxsrhsje
            String srhsje = Util.null2String(rs.getString("srhsje"));
            dt1data.put("srmxsrhsje", srhsje);
            //收入不含税金额 srbhsje 收入明细 收入明细-收入不含税金额 srmxsrbhsje
            String srbhsje = Util.null2String(rs.getString("srbhsje"));
            dt1data.put("srmxsrbhsje", srbhsje);
            //税额 se 收入明细 收入明细-税额 srmxse
            String se = Util.null2String(rs.getString("se"));
            dt1data.put("srmxse", se);
            //核销凭证号 hxpzh 收入明细 收入明细-核销凭证号 srmxhxpzh
            String hxpzh = Util.null2String(rs.getString("hxpzh"));
            dt1data.put("srmxhxpzh", hxpzh);
            //经济事项 jjsx 收入明细 收入明细-经济事项编码 srmxjjsxbm
            String jjsx = Util.null2String(rs.getString("jjsx"));
            dt1data.put("srmxjjsxbm", jjsx);
            //收款活动 skhd 收入明细 收入明细-收款活动编码 srmxskhdbm
            String skhd = Util.null2String(rs.getString("skhd"));
            dt1data.put("srmxskhdbm", skhd);
            //认领金额 rlje 收入明细 收入明细-认领金额 rlje
            String rlje = Util.null2String(rs.getString("rlje"));
            dt1data.put("rlje", rlje);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt22 where mainid = ?";
        boolean b22 = rs.executeQuery(sql, mainid);
        while (b22 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //原受益部门 ysybm 原费用明细（费用调整流程） 原受益部门 ysybm
            String ysybm = Util.null2String(rs.getString("ysybm"));
            dt1data.put("ysybm", ysybm);
            //原部门属性 ybmzx 原费用明细（费用调整流程） 原部门属性 ybmsx
            String ybmzx = Util.null2String(rs.getString("ybmzx"));
            dt1data.put("ybmsx", ybmzx);
            //原报账金额 ybzje 原费用明细（费用调整流程） 原报账金额 ybzje
            String ybzje = Util.null2String(rs.getString("ybzje"));
            dt1data.put("ybzje", ybzje);
            //原经济事项 yjjsx 原费用明细（费用调整流程） 原经济事项 yjjsx
            String yjjsx = Util.null2String(rs.getString("yjjsx"));
            dt1data.put("yjjsx", yjjsx);
            //原合同关联编号 yhtglbh 原费用明细（费用调整流程） 原费用-合同编号 yfyhtbh
            String yhtglbh = Util.null2String(rs.getString("yhtglbh"));
            dt1data.put("yfyhtbh", yhtglbh);
            //原费用-供应商 yfygys 原费用明细（费用调整流程） 原费用-供应商 yfygys
            String yfygys = Util.null2String(rs.getString("yfygys"));
            dt1data.put("yfygys", yfygys);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt20 where mainid = ?";
        boolean b20 = rs.executeQuery(sql, mainid);
        while (b20 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //核算业务分类 hsywfl 核算业务分类 srhsywfl
            String hsywfl = Util.null2String(rs.getString("hsywfl"));
            dt1data.put("srhsywfl", hsywfl);
            //客商 ks 预收结转明细 预收结转明细-客商编码 ysjzmxksbm
            String ks = Util.null2String(rs.getString("ks"));
            dt1data.put("ysjzmxksbm", ks);
            //合同关联编号 htglbh 预收结转明细 预收结转明细-合同编号 ysjzmxhtbh
            String htglbh = Util.null2String(rs.getString("htglbh"));
            dt1data.put("ysjzmxhtbh", htglbh);
            //本次结转金额 bcjzje 预收结转明细 本次结转金额 ysjzmxbcjzje
            String bcjzje = Util.null2String(rs.getString("bcjzje"));
            dt1data.put("ysjzmxbcjzje", bcjzje);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt19 where mainid = ?";
        boolean b19 = rs.executeQuery(sql, mainid);
        while (b19 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //冲销结转金额 cxjzje 原报账单子表明细行 冲销结转金额 cxjzje
            String cxjzje = Util.null2String(rs.getString("cxjzje"));
            dt1data.put("cxjzje", cxjzje);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt23 where mainid = ?";
        boolean b23 = rs.executeQuery(sql, mainid);
        while (b23 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //原报账单号 ybzdh 换票明细 换票明细-原报账单号 hpmxybzdh
            String ybzdh = Util.null2String(rs.getString("ybzdh"));
            dt1data.put("hpmxybzdh", ybzdh);
            //新老税额差异 xlsecy 换票明细 换票明细-新老税额差异 hpmxxlsecy
            String xlsecy = Util.null2String(rs.getString("xlsecy"));
            dt1data.put("hpmxxlsecy", xlsecy);
            //新老税额差异（负数） xlsecyfs 换票明细 换票明细-新老税额差异（负数） hpmxxlsecyfs
            String xlsecyfs = Util.null2String(rs.getString("xlsecyfs"));
            dt1data.put("hpmxxlsecyfs", xlsecyfs);
            //原发票税额 yfpse 换票明细 换票明细-原发票税额 hpmxyfpse
            String yfpse = Util.null2String(rs.getString("yfpse"));
            dt1data.put("hpmxyfpse", yfpse);
            //原发票认证状态 yfprzzt 换票明细 换票明细-原发票认证状态 hpmxyfprzzt
            String yfprzzt = Util.null2String(rs.getString("yfprzzt"));
            dt1data.put("hpmxyfprzzt", yfprzzt);
            //换票类型 hplx 换票明细 换票明细-换票类型 hpmxhplx
            String hplx = Util.null2String(rs.getString("hplx"));
            dt1data.put("hpmxhplx", hplx);
            //经济事项 jjsx 换票明细 换票明细-经济事项编码 hpmxjjsx
            String jjsx = Util.null2String(rs.getString("jjsx"));
            dt1data.put("hpmxjjsx", jjsx);
            //部门属性 bmsx 换票明细 换票明细-部门属性 hpmxbmsx
            String bmsx = Util.null2String(rs.getString("bmsx"));
            dt1data.put("hpmxbmsx", bmsx);
            //是否抵扣 sfdk 换票明细 换票明细-是否抵扣 hpmxsfdk
            String sfdk = Util.null2String(rs.getString("sfdk"));
            dt1data.put("hpmxsfdk", sfdk);
            //原发票类型 yfplx 换票明细 换票明细-原发票类型 hpmxyfplx
            String yfplx = Util.null2String(rs.getString("yfplx"));
            dt1data.put("hpmxyfplx", yfplx);
            //新发票类型 xfplx 换票明细 换票明细-新发票类型 hpmxxfplx
            String xfplx = Util.null2String(rs.getString("xfplx"));
            dt1data.put("hpmxxfplx", xfplx);
            //原报账单类型 ybzdlx 换票明细 换票明细-原报账单类型 hpmxybzdlx
            String ybzdlx = Util.null2String(rs.getString("ybzdlx"));
            dt1data.put("hpmxybzdlx", ybzdlx);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt3 where mainid = ?";
        boolean b3 = rs.executeQuery(sql, mainid);
        while (b3 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //所属行业 szhy 转出明细 所属行业 zcmxszhy
            String szhy = Util.null2String(rs.getString("szhy"));
            dt1data.put("zcmxszhy", szhy);
            //本次转出税额 zcse 转出明细 本次转出税额 zcmxzcse
            String zcse = Util.null2String(rs.getString("zcse"));
            dt1data.put("zcmxzcse", zcse);
            //本次转出税额（负数） zcsefs 转出明细 本次转出税额（负数） zcmxzcsefs
            String zcsefs = Util.null2String(rs.getString("zcsefs"));
            dt1data.put("zcmxzcsefs", zcsefs);
            //本次转出税额/税率 zcsesl 转出明细 本次转出税额/税率 zcmxzcsesl
            String zcsesl = Util.null2String(rs.getString("zcsesl"));
            dt1data.put("zcmxzcsesl", zcsesl);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt4 where mainid = ?";
        boolean b4 = rs.executeQuery(sql, mainid);
        while (b4 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //所属行业 szhy 行业明细 行业明细-所属行业 hymxszhy
            String szhy = Util.null2String(rs.getString("szhy"));
            dt1data.put("hymxszhy", szhy);
            //核定税额 hdse 行业明细 行业明细-核定税额 hymxhdse
            String hdse = Util.null2String(rs.getString("hdse"));
            dt1data.put("hymxhdse", hdse);
            //核定总额（不含税） zebhs 行业明细 行业明细-核定总额（不含税） hymxzebhs
            String zebhs = Util.null2String(rs.getString("zebhs"));
            dt1data.put("hymxzebhs", zebhs);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt5 where mainid = ?";
        boolean b5 = rs.executeQuery(sql, mainid);
        while (b5 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //税额 se 发票明细 发票明细-税额 fpmxse
            String se = Util.null2String(rs.getString("se"));
            dt1data.put("fpmxse", se);
            //发票类型 fplx 发票明细 发票明细-发票类型 fpmxfplx
            String fplx = Util.null2String(rs.getString("fplx"));
            dt1data.put("fpmxfplx", fplx);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt6 where mainid = ?";
        boolean b6 = rs.executeQuery(sql, mainid);
        while (b6 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //核销凭证号 hxpzh 核销计提明细 核销计提明细-核销凭证号 hxjtmxhxpzh
            String hxpzh = Util.null2String(rs.getString("hxpzh"));
            dt1data.put("hxjtmxhxpzh", hxpzh);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt7 where mainid = ?";
        boolean b7 = rs.executeQuery(sql, mainid);
        while (b7 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //修改后核算主体 xghhszt 修改后支付信息 修改后支付信息-修改后核算主体 xghzfxxxghhszt
            String xghhszt = Util.null2String(rs.getString("xghhszt"));
            dt1data.put("xghzfxxxghhszt", xghhszt);
            //支付单号 zfdh 修改后支付信息 修改后支付信息-支付单号 xghzfxxzfdh
            String zfdh = Util.null2String(rs.getString("zfdh"));
            dt1data.put("xghzfxxzfdh", zfdh);
            //银行账户 xghjszh 修改后支付信息 修改后支付信息-银行账户 xghzfxxxghjszh
            String xghjszh = Util.null2String(rs.getString("xghjszh"));
            dt1data.put("xghzfxxxghjszh", xghjszh);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt8 where mainid = ?";
        boolean b8 = rs.executeQuery(sql, mainid);
        while (b8 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //原核算主体 yhszt 原支付单信息 原支付单-原核算主体 yzfdyhszt
            String yhszt = Util.null2String(rs.getString("yhszt"));
            dt1data.put("yzfdyhszt", yhszt);
            //收款单号 skdh 原支付单信息 原支付单-收款单号 yzfdskdh
            String skdh = Util.null2String(rs.getString("skdh"));
            dt1data.put("yzfdskdh", skdh);
            //相关支付单 xgzfd 原支付单信息 原支付单-相关支付单 yzfdxgzfd
            String xgzfd = Util.null2String(rs.getString("xgzfd"));
            dt1data.put("yzfdxgzfd", xgzfd);
            //经办人 jbr 原支付单信息 原支付单-经办人 yzfdjbr
            String jbr = Util.null2String(rs.getString("jbr"));
            dt1data.put("yzfdjbr", jbr);
            //经办人部门 jbrbm 原支付单信息 原支付单-经办人部门 yzfdjbrbm
            String jbrbm = Util.null2String(rs.getString("jbrbm"));
            dt1data.put("yzfdjbrbm", jbrbm);
            //经办人公司 jbrgs 原支付单信息 原支付单-经办人公司 yzfdjbrgs
            String jbrgs = Util.null2String(rs.getString("jbrgs"));
            dt1data.put("yzfdjbrgs", jbrgs);
            //退票凭证号 tppzh 原支付单信息 原支付单-退票凭证号 yzfdtppzh
            String tppzh = Util.null2String(rs.getString("tppzh"));
            dt1data.put("yzfdtppzh", tppzh);
            //原结算银行账户 yjsyhzh 原支付单信息 原支付单-原结算银行账户 yzfdyjsyhzh
            String yjsyhzh = Util.null2String(rs.getString("yjsyhzh"));
            dt1data.put("yzfdyjsyhzh", yjsyhzh);
            //支付金额 zfje 原支付单信息 原支付单-支付金额 yzfdzfje
            String zfje = Util.null2String(rs.getString("zfje"));
            dt1data.put("yzfdzfje", zfje);

            params.add(dt1data);
        }


        sql = "select * from uf_ywtokjyqzjb_dt10 where mainid = ?";
        boolean b10 = rs.executeQuery(sql, mainid);
        while (b10 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //收款方核算主体 skfhszt 收款明细表 收款明细-收款方核算主体 skmxskfhszt
            String skfhszt = Util.null2String(rs.getString("skfhszt"));
            dt1data.put("skmxskfhszt", skfhszt);
            //付款方核算主体 fkfhszt 收款明细表 收款明细-付款方核算主体 skmxfkfhszt
            String fkfhszt = Util.null2String(rs.getString("fkfhszt"));
            dt1data.put("skmxfkfhszt", fkfhszt);
            //入账日期 rzrq 收款明细表 收款明细-入账日期 skmxrzrq
            String rzrq = Util.null2String(rs.getString("rzrq"));
            dt1data.put("skmxrzrq", rzrq);
            //付款单位 fkdw 收款明细表 收款明细-付款单位编码 skmxfkdwbm
            String fkdw = Util.null2String(rs.getString("fkdw"));
            dt1data.put("skmxfkdwbm", fkdw);
            //收款账户 skzh 收款明细表 收款明细-收款账户 skmxskdw
            String skzh = Util.null2String(rs.getString("skzh"));
            dt1data.put("skmxskzh", skzh);
            //金额 je 收款明细表 收款明细-金额 skmxje
            String je = Util.null2String(rs.getString("je"));
            dt1data.put("skmxje", je);
            //资金来源 zjly 收款明细表 收款明细-资金来源名称 skmxzjlymc
            String zjly = Util.null2String(rs.getString("zjly"));
            dt1data.put("skmxzjlymc", zjly);
            //付款账户 fkzh 收款明细表 收款明细-付款账户 skmxfkzh
            String fkzh = Util.null2String(rs.getString("fkzh"));
            dt1data.put("skmxfkzh", fkzh);
            //收款单位 skdw 收款明细表 收款明细-收款单位编码 skmxskdwbm
            String skdw = Util.null2String(rs.getString("skdw"));
            dt1data.put("skmxskdwbm", skdw);
            //是否生成凭证 sfscpz 收款明细表 收款明细-是否生成凭证 skmxsfscpz
            String sfscpz = Util.null2String(rs.getString("sfscpz"));
            dt1data.put("skmxsfscpz", sfscpz);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt11 where mainid = ?";
        boolean b11 = rs.executeQuery(sql, mainid);
        while (b11 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //单位 dw 企业年金明细 企业年金明细-单位 qynjmxdw
            String dw = Util.null2String(rs.getString("dw"));
            dt1data.put("qynjmxdw", dw);
            //个人缴纳 grjn 企业年金明细 企业年金明细-个人缴纳 qynjmxgrjn
            String grjn = Util.null2String(rs.getString("grjn"));
            dt1data.put("qynjmxgrjn", grjn);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt12 where mainid = ?";
        boolean b12 = rs.executeQuery(sql, mainid);
        while (b12 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //经济事项 jjsx 企业年金映射 企业年金映射-经济事项 qynjysjjsx
            String jjsx = Util.null2String(rs.getString("jjsx"));
            dt1data.put("qynjysjjsx", jjsx);
            //单位 dw 企业年金映射 企业年金映射-单位 qynjysdw
            String dw = Util.null2String(rs.getString("dw"));
            dt1data.put("qynjysdw", dw);
            //本方科目编码 bfkmbm 企业年金映射 企业年金映射-本方科目编码 qynjysbfkmbm
            String bfkmbm = Util.null2String(rs.getString("bfkmbm"));
            dt1data.put("qynjysbfkmbm", bfkmbm);
            //借方金额 jfje 企业年金映射 企业年金映射-借方金额 qynjysjfje
            String jfje = Util.null2String(rs.getString("jfje"));
            dt1data.put("qynjysjfje", jfje);
            //对方科目编码 dfkmbm 企业年金映射 企业年金映射-对方科目编码 qynjysdfkmbm
            String dfkmbm = Util.null2String(rs.getString("dfkmbm"));
            dt1data.put("qynjysdfkmbm", dfkmbm);
            //贷方金额 dfje 企业年金映射 企业年金映射-贷方金额 qynjysdfje
            String dfje = Util.null2String(rs.getString("dfje"));
            dt1data.put("qynjysdfje", dfje);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt13 where mainid = ?";
        boolean b13 = rs.executeQuery(sql, mainid);
        while (b13 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //经济事项 jjsx 分摊映射表 分摊明细-经济事项 ftmxjjsx
            String jjsx = Util.null2String(rs.getString("jjsx"));
            dt1data.put("ftmxjjsx", jjsx);
            //员工类型 yglx 分摊映射表 分摊明细-员工类型 ftmxyglx
            String yglx = Util.null2String(rs.getString("yglx"));
            dt1data.put("ftmxyglx", yglx);
            //部门 bm 分摊映射表 分摊明细-部门 ftmxbm
            String bm = Util.null2String(rs.getString("bm"));
            dt1data.put("ftmxbm", bm);
            //本方科目编码 bfkmbm 分摊映射表 分摊明细-本方科目编码 ftmxbfkmbm
            String bfkmbm = Util.null2String(rs.getString("bfkmbm"));
            dt1data.put("ftmxbfkmbm", bfkmbm);
            //对方科目编码 dfkmbm 分摊映射表 分摊明细-对方科目编码 ftmxdfkmbm
            String dfkmbm = Util.null2String(rs.getString("dfkmbm"));
            dt1data.put("ftmxdfkmbm", dfkmbm);
            //借方金额 jfje 分摊映射表 分摊明细-借方金额 ftmxjfje
            String jfje = Util.null2String(rs.getString("jfje"));
            dt1data.put("ftmxjfje", jfje);
            //本方子目编码 bfzmbm 分摊映射表 分摊明细-本方子目编码 ftmxbfzmbm
            String bfzmbm = Util.null2String(rs.getString("bfzmbm"));
            dt1data.put("ftmxbfzmbm", bfzmbm);
            //对方子目编码 dfzmbm 分摊映射表 分摊明细-对方子目编码 ftmxdfzmbm
            String dfzmbm = Util.null2String(rs.getString("dfzmbm"));
            dt1data.put("ftmxdfzmbm", dfzmbm);
            //贷方金额 dfje 分摊映射表 分摊明细-贷方金额 ftmxdfje
            String dfje = Util.null2String(rs.getString("dfje"));
            dt1data.put("ftmxdfje", dfje);
            //现金流编码 xjllbm 分摊映射表 分摊明细-现金流编码 ftmxxjllbm
            String xjllbm = Util.null2String(rs.getString("xjllbm"));
            dt1data.put("ftmxxjllbm", xjllbm);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt14 where mainid = ?";
        boolean b14 = rs.executeQuery(sql, mainid);
        while (b14 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //金额 je 存单明细 存单明细-金额 cdmxje
            String je = Util.null2String(rs.getString("je"));
            dt1data.put("cdmxje", je);
            //存期 cq 存单明细 存单明细-存期 cdmxcq
            String cq = Util.null2String(rs.getString("cq"));
            dt1data.put("cdmxcq", cq);
            //支取本金 zqbj 存单明细 存单明细-支取本金 cdmxzqbj
            String zqbj = Util.null2String(rs.getString("zqbj"));
            dt1data.put("cdmxzqbj", zqbj);
            //利息收入 lxsr 存单明细 存单明细-利息收入 cdmxlxsr
            String lxsr = Util.null2String(rs.getString("lxsr"));
            dt1data.put("cdmxlxsr", lxsr);
            //已计提利息收入 yjtlxsr 存单明细 存单明细-已计提利息收入 cdmxyjtlxsr
            String yjtlxsr = Util.null2String(rs.getString("yjtlxsr"));
            dt1data.put("cdmxyjtlxsr", yjtlxsr);
            //当期入账利息 dqrzlx 存单明细 存单明细-当期入账利息 cdmxdqrzlx
            String dqrzlx = Util.null2String(rs.getString("dqrzlx"));
            dt1data.put("cdmxdqrzlx", dqrzlx);
            //实际支取金额 sjzqje 存单明细 存单明细-实际支取金额 cdmxsjzqje
            String sjzqje = Util.null2String(rs.getString("sjzqje"));
            dt1data.put("cdmxsjzqje", sjzqje);
            //银行账户 yhzh 存单明细 存单明细-银行账户 cdmxyhzh
            String yhzh = Util.null2String(rs.getString("yhzh"));
            dt1data.put("cdmxyhzh", yhzh);
            //计提年月 jtny 存单明细 存单明细-计提年月 cdmxjtny
            String jtny = Util.null2String(rs.getString("jtny"));
            dt1data.put("cdmxjtny", jtny);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt15 where mainid = ?";
        boolean b15 = rs.executeQuery(sql, mainid);
        while (b15 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //本次退款金额 bctkje 负数应收单明细 负数应收单明细-本次退款金额 fsysdbctkje
            String bctkje = Util.null2String(rs.getString("bctkje"));
            dt1data.put("fsysdbctkje", bctkje);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt16 where mainid = ?";
        boolean b16 = rs.executeQuery(sql, mainid);
        while (b16 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //客商 ks 认领明细 认领明细-客商编码 rlmxksbm
            String ks = Util.null2String(rs.getString("ks"));
            dt1data.put("rlmxksbm", ks);
            //本次退回金额 bcthje 认领明细 认领明细-本次退回金额 rlmxbcthje
            String bcthje = Util.null2String(rs.getString("bcthje"));
            dt1data.put("rlmxbcthje", bcthje);
            //本次冲销报账金额 bccxbzje 认领明细 认领明细-本次冲销报账金额 rlmxbccxbzje
            String bccxbzje = Util.null2String(rs.getString("bccxbzje"));
            dt1data.put("rlmxbccxbzje", bccxbzje);
            //本次退款金额 bctkje 认领明细 认领明细-本次退款金额 rlmxbctkje
            String bctkje = Util.null2String(rs.getString("bctkje"));
            dt1data.put("rlmxbctkje", bctkje);
            //结算账户 jszh 认领明细 认领明细-结算账户 rlmxjszh
            String jszh = Util.null2String(rs.getString("jszh"));
            dt1data.put("rlmxjszh", jszh);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt17 where mainid = ?";
        boolean b17 = rs.executeQuery(sql, mainid);
        while (b17 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);

            //合同关联编号 htglbh 收款明细 收款明细-合同编号 skmxhtbh
            String htglbh = Util.null2String(rs.getString("htglbh"));
            dt1data.put("skmxhtbh", htglbh);
            //客商 ks 收款明细 收款明细-客商编码 skmxksbm
            String ks = Util.null2String(rs.getString("ks"));
            dt1data.put("skmxksbm", ks);
            //本次退回金额 bcthje 收款明细 收款明细-本次退回金额 skmxbcthje
            String bcthje = Util.null2String(rs.getString("bcthje"));
            dt1data.put("skmxbcthje", bcthje);

            params.add(dt1data);
        }

        sql = "select * from uf_ywtokjyqzjb_dt18 where mainid = ?";
        boolean b18 = rs.executeQuery(sql, mainid);
        while (b18 && rs.next()) {
            Map<String, String> dt1data = new HashMap<>();
            dt1data.putAll(mainData);
            //客商 kh 收入结转明细 收入结转明细-客商编码 srjzmxkhbm
            String kh = Util.null2String(rs.getString("kh"));
            dt1data.put("srjzmxkhbm", kh);
            //本次实际结转含税金额 bcsjjzhsje 收入结转明细 收入结转明细-本次实际结转含税金额 srjzmxbcsjjzhsje
            String bcsjjzhsje = Util.null2String(rs.getString("bcsjjzhsje"));
            dt1data.put("srjzmxbcsjjzhsje", bcsjjzhsje);
            //经济事项 jjsx 收入结转明细 收入结转明细-经济事项编码 srjzmxjjsxbm
            String jjsx = Util.null2String(rs.getString("jjsx"));
            dt1data.put("srjzmxjjsxbm", jjsx);
            //核算业务分类 hsywfl 收入结转明细 收入结转明细-核算业务分类 srjzmxhsywfl
            String hsywfl = Util.null2String(rs.getString("hsywfl"));
            dt1data.put("srjzmxhsywfl", hsywfl);

            params.add(dt1data);
        }





        map.put("params", params.toString());
        return map;
    }



    /**
     * 根据workflowid 获取流程表单名称
     * @param workflowid
     * @param rs
     * @return
     */
    private String getWfTablenamById(String workflowid, RecordSet rs) {
        String sql = "select t2.tablename from workflow_base t1 " +
                "left join workflow_bill t2 on t1.formid = t2.id where t1.id = ?";
        boolean b = rs.executeQuery(sql, workflowid);
        if(b && rs.next()) {
            return Util.null2String(rs.getString(1));
        }else {
            return "";
        }
    }

    private String getTreeId (String val) {
        try{
            String[] split = val.split("_");
            int length = split.length;
            return split[length-1];
        }catch (Exception e) {
            return val;
        }
    }

    /**
     * 字段转换
     * @param value
     * @param tablename
     * @param oldField
     * @param newField
     * @param rs
     * @return
     */
    private String changeField(String value, String tablename, String oldField, String newField, RecordSet rs) {
        String sql = "select "+newField+" from "+tablename+" where "+oldField+" = ?";
        boolean b = rs.executeQuery(sql, Util.null2String(value));
        if(b && rs.next()) {
            return Util.null2String(rs.getString(1));
        }else {
            return "";
        }
    }

    /**
     * 发送post请求
     * @param targetUrl
     * @param jsonParams
     * @return
     */
    private String sendJson(String targetUrl, String jsonParams) {
        JSONObject res = new JSONObject();
        res.put("err", "");
        try {
            CloseableHttpClient httpClient = HttpClients.createDefault();
            HttpPost httpPost = new HttpPost(targetUrl);
            StringEntity entity = new StringEntity(jsonParams);
            entity.setContentType("application/json;charset=UTF-8");
            httpPost.setEntity(entity);

            CloseableHttpResponse response = httpClient.execute(httpPost);
            int statusCode = response.getStatusLine().getStatusCode();
            res.put("statusCode", statusCode);

            String responseBody = EntityUtils.toString(response.getEntity());
            res.put("responseBosy", responseBody);
            httpClient.close();

            return res.toString();

        } catch (Exception e) {
            res.put("err", e.getMessage());
            writeLog("抛送会计引擎接口调用失败...message:"+e.getMessage(), e);
            return res.toString();
        }
    }
    private String czfsbm(String czfs){
        if(czfs.equals("1000003")){
            return "内部出资";
        }else if(czfs.equals("1000004")){
            return "外部出资";
        }else if(czfs.equals("1000005")){
            return "内外部联合出资";
        }else{
            return "";
        }
    }

    /**
     * 发送get请求
     * @param targetUrl
     * @param
     * @return
     */
    private String getJson(String targetUrl) {
        JSONObject res = new JSONObject();
        res.put("err", "");
        try {
            CloseableHttpClient httpClient = HttpClients.createDefault();
            HttpGet httpGet = new HttpGet(targetUrl);
            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();
            httpGet.setConfig(requestConfig);
            //3.使用httpClient发起请求并响应获取repsonse
            CloseableHttpResponse response =  httpClient.execute(httpGet);
            int statusCode = response.getStatusLine().getStatusCode();
            res.put("statusCode", statusCode);

            String responseBody = EntityUtils.toString(response.getEntity());
            res.put("responseBosy", responseBody);
            httpClient.close();

            return res.toString();

        } catch (Exception e) {
            res.put("err", e.getMessage());
            writeLog("查看接口调用失败...message:"+e.getMessage(), e);
            return res.toString();
        }
    }

    private String jdfx(String jdfx){
        if(jdfx.equals("0")){
            return "借";
        }else  if(jdfx.equals("1")){
            return "贷";
        }else{
            return "";
        }
    }

    private String hdfx(String hdfx){
        if(hdfx.equals("1000036")){
            return "立减";
        }else if(hdfx.equals("1000037")){
            return "积分(普通)";
        }else if(hdfx.equals("1000038")){
            return "奖励金";
        }else if(hdfx.equals("1000039")){
            return "积分(消费送";
        }else{
            return "";
        }
    }

    private String bmsx(String bmsx){
        if(bmsx.equals("1000453")){
            return "生产";
        }else if(bmsx.equals("1000454")){
            return "营销";
        }else if(bmsx.equals("1000455")){
            return "管理";
        }else if(bmsx.equals("1000456")){
            return "研发";
        }else if(bmsx.equals("1000457")){
            return "公共";
        }else if(bmsx.equals("1000458")){
            return "生产运营";
        }else{
            return "";
        }
    }

}
